/*
 * @Descripttion: 
 * @version: 
 * @Author: mmzhang
 * @Date: 2021-07-23 11:03:01
 * @LastEditTime: 2021-11-16 11:48:28
 */
import tootipMsg from './tootipMsg.vue'
let vm = null;

const sendThis = (_this) => {
  vm = _this;
};
export default {
  sendThis,
  columns: [{
    title: '执行周期',
    key: 'rangePeriod',
    minWidth: 250,
    fixed: 'left',
    tree: true
  },
  {
    title: '审核状态',
    key: 'auditStatusDesc',
    minWidth: 180,
    render: (h, params) => {
      return h(
        'div',
        {
          style: {
            display: 'flex',
            flexDirection: 'column',
          },
        },
        [
          h(
            'Poptip',
            {
              props: {
                transfer: true,
                width: '380',
                trigger: 'click',
                confirm: true,
                okText: '',
                cancelText: 'X',
                popperClass: 'M_poptip'
              },
              on: {
                'on-ok': () => {},
              },
            },
            [
              h(
                'Button',
                {
                  props: {
                    type: 'text',
                  },
                  style: {
                    color: '#2d8cf0',
                    cursor: 'pointer',
                  },
                  on: {
                    click: (e) => {
                      (params.row.auditStatusDesc == '' || params.row
                        .auditStatusDesc == '草稿') && e.stopPropagation()
                      vm.getAuditLog(params.row)
                    },
                  },
                },
                params.row.auditStatusDesc
              ),
              h(tootipMsg, {
                slot: 'title',
                props: {
                  logList: vm.logList
                },
                on: {
                  popClose: (val) => {},
                },
              }),
            ]
          ),
        ]
      )
    },
  },
  {
    title: '执行状态',
    key: 'executeStatus',
    minWidth: 180,
    render: (h, params) => {
      return h('div',
        params.row.levelDesc == '周期' ? params.row.executeStatusDesc : ''
      )
    },
  },
  {
    title: '合作模式',
    key: 'cooperateType',
    minWidth: 180,
    renderHeader: (h, params) => {
      return h('div', [
        h('span', {}, '合作模式'),
        h('Icon', {
          props: {
            type: 'ios-arrow-down',
            size: '16',
          },
          style: {
            marginLeft: '5px',
          },
          nativeOn: {
            mouseover: (event) => {
              event.stopPropagation()
              vm.thMouseoverFun(
                event,
                'Select-cooperateType-coopModesList',
                '请选择合作模式',
                200
              )
            },
            mouseleave: (event) => {
              event.stopPropagation()
              vm.thMouseoutFun()
            },
          },
        }),
      ])
    },
  },
  {
    title: '营销成本（元）',
    key: 'targetMarketCost',
    minWidth: 180,
    render: (h, params) => {
      return h('div',
        vm.$tool.formatNumtoLocaleString(params.row.targetMarketCost)
      )
    },
  },
  {
    title: '目标线索',
    key: 'targetClue',
    minWidth: 130,
  },
  {
    title: '目标来人',
    key: 'targetVisit',
    minWidth: 130,
  },
  {
    title: '目标认购套数',
    key: 'targetSubscribe',
    minWidth: 130,
  },
  {
    title: '目标签约套数',
    key: 'targetSign',
    minWidth: 130,
  },
  {
    title: '目标签约面积（㎡）',
    key: 'targetSignArea',
    minWidth: 150,
    render: (h, params) => {
      return h('div',
        vm.$tool.formatNumtoLocaleString(params.row.targetSignArea)
      )
    },
  },
  {
    title: '目标签约金额（元）',
    key: 'targetSignAmount',
    minWidth: 150,
    render: (h, params) => {
      return h('div',
        vm.$tool.formatNumtoLocaleString(params.row.targetSignAmount)
      )
    },
  },
  {
    title: '创建人',
    key: 'createUser',
    minWidth: 130,
    renderHeader: (h, params) => {
      return h('div', [
        h('span', {}, '创建人'),
        h('Icon', {
          props: {
            type: 'ios-arrow-down',
            size: '16',
          },
          style: {
            marginLeft: '5px',
          },
          nativeOn: {
            mouseover: (event) => {
              event.stopPropagation()
              vm.thMouseoverFun(
                event,
                'Select-createUser-createUserList',
                '请选择创建人',
                200
              )
            },
            mouseleave: (event) => {
              event.stopPropagation()
              vm.thMouseoutFun()
            },
          },
        }),
      ])
    },
  },
  {
    title: '创建日期',
    key: 'createDate',
    minWidth: 130,
    renderHeader: (h, params) => {
      return h('div', [
        h('span', {}, '创建日期'),
        h('Icon', {
          props: {
            type: 'ios-arrow-down',
            size: '16',
          },
          style: {
            marginLeft: '5px',
          },
          nativeOn: {
            mouseover: (event) => {
              event.stopPropagation()
              vm.thMouseoverFun(
                event,
                'datePicker-createDate-daterange-date && date.valueOf() > new Date().getTime()',
                '请选择创建日期',
                200
              )
            },
            mouseleave: (event) => {
              event.stopPropagation()
              vm.thMouseoutFun()
            },
          },
        }),
      ])
    },
    render: (h, params) => {
      return h('div',
        vm.$tool.formatterDate(params.row.createDate)
      )
    },
  },
  {
    title: '操作',
    fixed: 'right',
    width: 140,
    align: 'center',
    render: (h, params) => {
      return h('div', [
        h(
          'a', {
            style: {
              padding: '0 6px',
              display: ['1', '2', '3', '4', '5'].indexOf(params.row.auditStatus) > -
                1 ? 'inline-block' : 'none'
            },
            on: {
              click: (e) => {
                e.stopPropagation()
                vm.viewTargetFun(params.row)
              },
            },
          },
          '查看'
        ),
        h(
          'a', {
            style: {
              padding: '0 6px',
              display: ((vm.unlocking('0107070102') && params.row.levelDesc ==
                  '周期') || (vm.unlocking('0107070107') && params.row.levelDesc ==
                  '周')) && (params.row.changeButtonFlag.toString() == "true") ?
                'inline-block' : 'none'
            },
            on: {
              click: (e) => {
                e.stopPropagation()
                vm.adjustTargetFun(params.row, 2)
              },
            },
          },
          '调整'
        ),
        h(
          'a', {
            style: {
              padding: '0 6px',
              display: vm.unlocking('0107070103') && (params.row.levelDesc == '月' &&
                !params.row.children.length && params.row.auditStatus == '4' &&
                params.row.executeStatus != '4') ? 'inline-block' : 'none'
            },
            on: {
              click: (e) => {
                e.stopPropagation()
                vm.splitWeekFun(params.row)
              },
            },
          },
          '拆分周指标'
        ),
        h(
          'a', {
            style: {
              padding: '0 6px',
              display: ((vm.unlocking('0107070106') && params.row.levelDesc ==
                '周期') || (vm.unlocking('0107070109') && params.row.levelDesc ==
                '周')) && params.row.auditStatus == '0' ? 'inline-block' : 'none'
            },
            on: {
              click: (e) => {
                e.stopPropagation()
                vm.adjustTargetFun(params.row, 3)
              },
            },
          },
          '修改'
        ),
        h(
          'a', {
            style: {
              padding: '0 6px',
              display: ((vm.unlocking('0107070104') && params.row.levelDesc ==
                '周期') || (vm.unlocking('0107070108') && params.row.levelDesc ==
                '周')) && (params.row.againButtonFlag && params.row
                .againButtonFlag.toString() == 'true') ? 'inline-block' : 'none'
            },
            on: {
              click: (e) => {
                e.stopPropagation()
                vm.adjustTargetFun(params.row, 4)
              },
            },
          },
          '重新发起'
        ),
      ])
    },
  }, ],
}